package com.mine.util;

import java.io.File;
import java.util.ArrayList;

public class SearchFile {
	public static ArrayList<String> readDir(String path) throws Exception {
		ArrayList<String> al = new ArrayList<String>();
		if (path == null) {
			path = "..";
		}
		String fileDirAndName = "";
		try {
			File pathName = new File(path);
			String[] fileNames = pathName.list();
			for (int i = 0; i < fileNames.length; i++) {
				File f = new File(pathName.getPath(), fileNames[i]);
				if (f.isDirectory()) {
					if (f.getCanonicalPath().indexOf(".svn") == -1) {
						System.out.println("current dir is:"
								+ f.getCanonicalPath());
						readDir(f.getPath());
					}
				} else if (f.isFile()) {
					fileDirAndName = f.getCanonicalPath();
					int indexOfFileType = fileDirAndName.indexOf(".thr");
					if(indexOfFileType>0)
						al.add(fileDirAndName);
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return al;
	}

//	public static void main(String[] args) throws Exception {
//		new SearchFile()
//				.readDir("F:\\Stress\\K-Touch\\dalvik\\KTouch_DALVIKVM_NOJIT�汾_150s");
//	}
}
